package com.huawei.petapp2.call;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.huawei.petapp2.entity.CartCount;
import com.huawei.petapp2.entity.Result;
import com.huawei.petapp2.utils.DateUtil;
import com.zhy.http.okhttp.callback.Callback;

import java.io.IOException;

import okhttp3.Response;

public abstract class CartCountBeanback extends Callback<CartCount>
{

    //非UI线程，支持任何耗时操作
    final private static Gson gson=new GsonBuilder().serializeNulls().create();
    //非UI线程，支持任何耗时操作

    @Override
    public CartCount parseNetworkResponse(Response response, int id) throws IOException
    {
        String string = response.body().string();
        Result result=gson.fromJson(string,Result.class);
        System.out.println("新的获取订单请求请求OnintView"+result);
        CartCount cartCount= DateUtil.getEntity(result,CartCount.class);
        return cartCount;
    }


}
